package reamodel.diagram.providers;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
import org.eclipse.gmf.runtime.common.core.service.IOperation;
import org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserProvider;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
import org.eclipse.gmf.runtime.notation.View;

import reamodel.ReamodelPackage;
import reamodel.diagram.edit.parts.DecrementCommitmentNameEditPart;
import reamodel.diagram.edit.parts.DecrementEconomicEventNameEditPart;
import reamodel.diagram.edit.parts.DecrementEconomicEventTypeNameEditPart;
import reamodel.diagram.edit.parts.EconomicAgentNameEditPart;
import reamodel.diagram.edit.parts.EconomicAgentTypeNameEditPart;
import reamodel.diagram.edit.parts.EconomicResourceNameEditPart;
import reamodel.diagram.edit.parts.EconomicResourceTypeNameEditPart;
import reamodel.diagram.edit.parts.IncrementCommitmentNameEditPart;
import reamodel.diagram.edit.parts.IncrementEconomicEventNameEditPart;
import reamodel.diagram.edit.parts.IncrementEconomicEventTypeNameEditPart;
import reamodel.diagram.edit.parts.InflowNameEditPart;
import reamodel.diagram.edit.parts.InflowTypeNameEditPart;
import reamodel.diagram.edit.parts.OutflowNameEditPart;
import reamodel.diagram.edit.parts.OutflowTypeNameEditPart;
import reamodel.diagram.edit.parts.ProvideParticipationNameEditPart;
import reamodel.diagram.edit.parts.ReceiveParticipationNameEditPart;
import reamodel.diagram.parsers.MessageFormatParser;
import reamodel.diagram.part.REAmodelVisualIDRegistry;

/**
 * @generated
 */
public class REAmodelParserProvider extends AbstractProvider implements
		IParserProvider {

	/**
	 * @generated
	 */
	private IParser economicResourceTypeName_4001Parser;

	/**
	 * @generated
	 */
	private IParser getEconomicResourceTypeName_4001Parser() {
		if (economicResourceTypeName_4001Parser == null) {
			economicResourceTypeName_4001Parser = createEconomicResourceTypeName_4001Parser();
		}
		return economicResourceTypeName_4001Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createEconomicResourceTypeName_4001Parser() {
		EAttribute[] features = new EAttribute[] { ReamodelPackage.eINSTANCE
				.getEconomicResourceType_Name(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser economicAgentTypeName_4002Parser;

	/**
	 * @generated
	 */
	private IParser getEconomicAgentTypeName_4002Parser() {
		if (economicAgentTypeName_4002Parser == null) {
			economicAgentTypeName_4002Parser = createEconomicAgentTypeName_4002Parser();
		}
		return economicAgentTypeName_4002Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createEconomicAgentTypeName_4002Parser() {
		EAttribute[] features = new EAttribute[] { ReamodelPackage.eINSTANCE
				.getEconomicAgentType_Name(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser decrementEconomicEventTypeName_4003Parser;

	/**
	 * @generated
	 */
	private IParser getDecrementEconomicEventTypeName_4003Parser() {
		if (decrementEconomicEventTypeName_4003Parser == null) {
			decrementEconomicEventTypeName_4003Parser = createDecrementEconomicEventTypeName_4003Parser();
		}
		return decrementEconomicEventTypeName_4003Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createDecrementEconomicEventTypeName_4003Parser() {
		EAttribute[] features = new EAttribute[] { ReamodelPackage.eINSTANCE
				.getEconomicEventType_Name(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser incrementEconomicEventTypeName_4004Parser;

	/**
	 * @generated
	 */
	private IParser getIncrementEconomicEventTypeName_4004Parser() {
		if (incrementEconomicEventTypeName_4004Parser == null) {
			incrementEconomicEventTypeName_4004Parser = createIncrementEconomicEventTypeName_4004Parser();
		}
		return incrementEconomicEventTypeName_4004Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createIncrementEconomicEventTypeName_4004Parser() {
		EAttribute[] features = new EAttribute[] { ReamodelPackage.eINSTANCE
				.getEconomicEventType_Name(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser economicAgentName_4005Parser;

	/**
	 * @generated
	 */
	private IParser getEconomicAgentName_4005Parser() {
		if (economicAgentName_4005Parser == null) {
			economicAgentName_4005Parser = createEconomicAgentName_4005Parser();
		}
		return economicAgentName_4005Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createEconomicAgentName_4005Parser() {
		EAttribute[] features = new EAttribute[] { ReamodelPackage.eINSTANCE
				.getEconomicAgent_Name(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser economicResourceName_4006Parser;

	/**
	 * @generated
	 */
	private IParser getEconomicResourceName_4006Parser() {
		if (economicResourceName_4006Parser == null) {
			economicResourceName_4006Parser = createEconomicResourceName_4006Parser();
		}
		return economicResourceName_4006Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createEconomicResourceName_4006Parser() {
		EAttribute[] features = new EAttribute[] { ReamodelPackage.eINSTANCE
				.getEconomicResource_Name(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser decrementEconomicEventName_4007Parser;

	/**
	 * @generated
	 */
	private IParser getDecrementEconomicEventName_4007Parser() {
		if (decrementEconomicEventName_4007Parser == null) {
			decrementEconomicEventName_4007Parser = createDecrementEconomicEventName_4007Parser();
		}
		return decrementEconomicEventName_4007Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createDecrementEconomicEventName_4007Parser() {
		EAttribute[] features = new EAttribute[] { ReamodelPackage.eINSTANCE
				.getEconomicEvent_Name(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser incrementEconomicEventName_4008Parser;

	/**
	 * @generated
	 */
	private IParser getIncrementEconomicEventName_4008Parser() {
		if (incrementEconomicEventName_4008Parser == null) {
			incrementEconomicEventName_4008Parser = createIncrementEconomicEventName_4008Parser();
		}
		return incrementEconomicEventName_4008Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createIncrementEconomicEventName_4008Parser() {
		EAttribute[] features = new EAttribute[] { ReamodelPackage.eINSTANCE
				.getEconomicEvent_Name(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser incrementCommitmentName_4009Parser;

	/**
	 * @generated
	 */
	private IParser getIncrementCommitmentName_4009Parser() {
		if (incrementCommitmentName_4009Parser == null) {
			incrementCommitmentName_4009Parser = createIncrementCommitmentName_4009Parser();
		}
		return incrementCommitmentName_4009Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createIncrementCommitmentName_4009Parser() {
		EAttribute[] features = new EAttribute[] { ReamodelPackage.eINSTANCE
				.getCommitment_Name(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser decrementCommitmentName_4010Parser;

	/**
	 * @generated
	 */
	private IParser getDecrementCommitmentName_4010Parser() {
		if (decrementCommitmentName_4010Parser == null) {
			decrementCommitmentName_4010Parser = createDecrementCommitmentName_4010Parser();
		}
		return decrementCommitmentName_4010Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createDecrementCommitmentName_4010Parser() {
		EAttribute[] features = new EAttribute[] { ReamodelPackage.eINSTANCE
				.getCommitment_Name(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser outflowName_4012Parser;

	/**
	 * @generated
	 */
	private IParser getOutflowName_4012Parser() {
		if (outflowName_4012Parser == null) {
			outflowName_4012Parser = createOutflowName_4012Parser();
		}
		return outflowName_4012Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createOutflowName_4012Parser() {
		EAttribute[] features = new EAttribute[] { ReamodelPackage.eINSTANCE
				.getStockflow_Name(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser inflowName_4014Parser;

	/**
	 * @generated
	 */
	private IParser getInflowName_4014Parser() {
		if (inflowName_4014Parser == null) {
			inflowName_4014Parser = createInflowName_4014Parser();
		}
		return inflowName_4014Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createInflowName_4014Parser() {
		EAttribute[] features = new EAttribute[] { ReamodelPackage.eINSTANCE
				.getStockflow_Name(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser outflowTypeName_4018Parser;

	/**
	 * @generated
	 */
	private IParser getOutflowTypeName_4018Parser() {
		if (outflowTypeName_4018Parser == null) {
			outflowTypeName_4018Parser = createOutflowTypeName_4018Parser();
		}
		return outflowTypeName_4018Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createOutflowTypeName_4018Parser() {
		EAttribute[] features = new EAttribute[] { ReamodelPackage.eINSTANCE
				.getStockflowType_Name(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser inflowTypeName_4020Parser;

	/**
	 * @generated
	 */
	private IParser getInflowTypeName_4020Parser() {
		if (inflowTypeName_4020Parser == null) {
			inflowTypeName_4020Parser = createInflowTypeName_4020Parser();
		}
		return inflowTypeName_4020Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createInflowTypeName_4020Parser() {
		EAttribute[] features = new EAttribute[] { ReamodelPackage.eINSTANCE
				.getStockflowType_Name(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser receiveParticipationName_4023Parser;

	/**
	 * @generated
	 */
	private IParser getReceiveParticipationName_4023Parser() {
		if (receiveParticipationName_4023Parser == null) {
			receiveParticipationName_4023Parser = createReceiveParticipationName_4023Parser();
		}
		return receiveParticipationName_4023Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createReceiveParticipationName_4023Parser() {
		EAttribute[] features = new EAttribute[] { ReamodelPackage.eINSTANCE
				.getParticipation_Name(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser provideParticipationName_4025Parser;

	/**
	 * @generated
	 */
	private IParser getProvideParticipationName_4025Parser() {
		if (provideParticipationName_4025Parser == null) {
			provideParticipationName_4025Parser = createProvideParticipationName_4025Parser();
		}
		return provideParticipationName_4025Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createProvideParticipationName_4025Parser() {
		EAttribute[] features = new EAttribute[] { ReamodelPackage.eINSTANCE
				.getParticipation_Name(), };
		MessageFormatParser parser = new MessageFormatParser(features);
		return parser;
	}

	/**
	 * @generated
	 */
	protected IParser getParser(int visualID) {
		switch (visualID) {
		case EconomicResourceTypeNameEditPart.VISUAL_ID:
			return getEconomicResourceTypeName_4001Parser();
		case EconomicAgentTypeNameEditPart.VISUAL_ID:
			return getEconomicAgentTypeName_4002Parser();
		case DecrementEconomicEventTypeNameEditPart.VISUAL_ID:
			return getDecrementEconomicEventTypeName_4003Parser();
		case IncrementEconomicEventTypeNameEditPart.VISUAL_ID:
			return getIncrementEconomicEventTypeName_4004Parser();
		case EconomicAgentNameEditPart.VISUAL_ID:
			return getEconomicAgentName_4005Parser();
		case EconomicResourceNameEditPart.VISUAL_ID:
			return getEconomicResourceName_4006Parser();
		case DecrementEconomicEventNameEditPart.VISUAL_ID:
			return getDecrementEconomicEventName_4007Parser();
		case IncrementEconomicEventNameEditPart.VISUAL_ID:
			return getIncrementEconomicEventName_4008Parser();
		case IncrementCommitmentNameEditPart.VISUAL_ID:
			return getIncrementCommitmentName_4009Parser();
		case DecrementCommitmentNameEditPart.VISUAL_ID:
			return getDecrementCommitmentName_4010Parser();
		case OutflowNameEditPart.VISUAL_ID:
			return getOutflowName_4012Parser();
		case InflowNameEditPart.VISUAL_ID:
			return getInflowName_4014Parser();
		case OutflowTypeNameEditPart.VISUAL_ID:
			return getOutflowTypeName_4018Parser();
		case InflowTypeNameEditPart.VISUAL_ID:
			return getInflowTypeName_4020Parser();
		case ReceiveParticipationNameEditPart.VISUAL_ID:
			return getReceiveParticipationName_4023Parser();
		case ProvideParticipationNameEditPart.VISUAL_ID:
			return getProvideParticipationName_4025Parser();
		}
		return null;
	}

	/**
	 * @generated
	 */
	public IParser getParser(IAdaptable hint) {
		String vid = (String) hint.getAdapter(String.class);
		if (vid != null) {
			return getParser(REAmodelVisualIDRegistry.getVisualID(vid));
		}
		View view = (View) hint.getAdapter(View.class);
		if (view != null) {
			return getParser(REAmodelVisualIDRegistry.getVisualID(view));
		}
		return null;
	}

	/**
	 * @generated
	 */
	public boolean provides(IOperation operation) {
		if (operation instanceof GetParserOperation) {
			IAdaptable hint = ((GetParserOperation) operation).getHint();
			if (REAmodelElementTypes.getElement(hint) == null) {
				return false;
			}
			return getParser(hint) != null;
		}
		return false;
	}

	/**
	 * @generated
	 */
	public static class HintAdapter extends ParserHintAdapter {

		/**
		 * @generated
		 */
		private final IElementType elementType;

		/**
		 * @generated
		 */
		public HintAdapter(IElementType type, EObject object, String parserHint) {
			super(object, parserHint);
			assert type != null;
			elementType = type;
		}

		/**
		 * @generated
		 */
		public Object getAdapter(Class adapter) {
			if (IElementType.class.equals(adapter)) {
				return elementType;
			}
			return super.getAdapter(adapter);
		}
	}

}
